﻿/*
 * Programmer: JR Padfield
 * Project: Crzy Math Totals
 * Description: Handles the sub total and grand total for sales, month, day, year
 * Version: 1
 * Date: 05/27/2013
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Crzy_Math
{
    public class Totals
    {
        #region Fields

        private static double subTotal;
        private static double grandTotal;

        private List<double> amounts;

        #endregion

        #region Properties

        public static double SubTotal
        {
            get { return subTotal; }
            set { subTotal = value; }
        }

        public static double GrandTotal
        {
            get { return grandTotal; }
            set { grandTotal = value; }
        }

        public void AddAmount(double amountToAdd)
        {
            amounts.Add(amountToAdd);
        }

        public double CalculateSubTotal()
        {
            // TODO: Figure out how to know what has already been processed
            SubTotal = 0.0;
            foreach (double amt in amounts)
            {
                subTotal += amt;
            }
            return SubTotal;
        }

        public double CalulateGrandTotal()
        {
            GrandTotal = 0.0;
            GrandTotal = Tax.TaxAmount + SubTotal;
            return GrandTotal;
        }

        #endregion
    }
}
